Skip to content

Conversation

@dungbik
Copy link
Contributor

@dungbik dungbik commented Jul 16, 2025

📝 변경 내용


✅ 체크리스트

  • 코드가 정상적으로 동작함
  • 테스트 코드 통과함
  • 문서(README 등)를 최신화함
  • 코드 스타일 가이드 준수

💬 기타 참고 사항

Summary by CodeRabbit

  • 신규 기능

    • 사용자 탈퇴(비활성화) 기능이 추가되었습니다. 이제 사용자는 계정을 비활성화할 수 있습니다.
  • 버그 수정

    • 없음
  • 리팩터

    • 내부 필드명 변경(deletedDatedeletedAt)으로 일관성이 향상되었습니다.
    • 테스트 코드에서 사용자 생성 방식을 개선하였습니다.
  • 테스트

    • 사용자 탈퇴 기능에 대한 테스트가 추가되었습니다.
    • 기존 회원가입 테스트의 사용자 생성 방식을 개선하였습니다.

@dungbik dungbik requested a review from stoneTiger0912 July 16, 2025 04:09
@dungbik dungbik self-assigned this Jul 16, 2025
@dungbik dungbik added the enhancement New feature or request label Jul 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 16, 2025

"""

Walkthrough

사용자 탈퇴(비활성화) 기능이 추가되었습니다. User 엔터티와 서비스, 컨트롤러, 저장소에 관련 메서드가 도입되었고, 소프트 딜리트 필드명이 변경되었습니다. 테스트 코드에는 사용자 탈퇴 케이스가 추가되고, 기존 사용자 생성 방식이 fixture로 개선되었습니다.

Changes

파일/경로 변경 요약
.../SoftDeletableEntity.java 소프트 딜리트 필드명 deletedDatedeletedAt로 변경 및 참조 수정
.../user/controller/UserController.java 사용자 탈퇴용 DELETE 엔드포인트 추가
.../user/entity/User.java softDelete() 오버라이드: 상태를 INACTIVE로 변경
.../user/repository/UserRepository.java findByIdAndStatus(Long, UserStatus) 메서드 추가
.../user/service/UserService.java unregister(Long) 및 findActiveUserById(Long) 메서드 추가
.../user/service/UserServiceTest.java 사용자 탈퇴 테스트 추가, fixture 기반 사용자 생성으로 리팩토링

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UserController
    participant UserService
    participant UserRepository
    participant User

    Client->>UserController: DELETE /v1/users (with 인증)
    UserController->>UserService: unregister(userId)
    UserService->>UserRepository: findByIdAndStatus(userId, ACTIVE)
    UserRepository-->>UserService: Optional<User>
    alt User exists
        UserService->>User: softDelete()
        UserService-->>UserController: void
        UserController-->>Client: 204 No Content
    else User not found
        UserService-->>UserController: BizException(USER_NOT_FOUND)
        UserController-->>Client: Error Response
    end
Loading

Poem

🐇
탈퇴의 길도 이제 활짝,
소프트하게 흔적만 남기고
상태는 INACTIVE로 조용히 변신!
컨트롤러와 서비스, 테스트도 척척
깔끔한 이름, 새로운 흐름
코드는 변해도 토끼는 늘 신남!

"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ce51b7 and e5ca6a3.

📒 Files selected for processing (1)
  • src/test/java/project/flipnote/user/service/UserServiceTest.java (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/java/project/flipnote/user/service/UserServiceTest.java
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b883244 and 1ce51b7.

📒 Files selected for processing (6)
  • src/main/java/project/flipnote/common/entity/SoftDeletableEntity.java (1 hunks)
  • src/main/java/project/flipnote/user/controller/UserController.java (2 hunks)
  • src/main/java/project/flipnote/user/entity/User.java (1 hunks)
  • src/main/java/project/flipnote/user/repository/UserRepository.java (1 hunks)
  • src/main/java/project/flipnote/user/service/UserService.java (2 hunks)
  • src/test/java/project/flipnote/user/service/UserServiceTest.java (5 hunks)
🔇 Additional comments (14)
src/main/java/project/flipnote/user/entity/User.java (1)

79-83: 소프트 딜리트 구현이 올바르게 작성되었습니다.

부모 클래스의 softDelete() 메서드를 호출한 후 사용자 상태를 INACTIVE로 설정하는 이중 보호 방식이 잘 구현되어 있습니다. 이는 데이터 일관성과 비즈니스 로직 측면에서 모범적인 접근 방식입니다.

src/main/java/project/flipnote/user/repository/UserRepository.java (1)

18-18: 리포지토리 메서드가 올바르게 추가되었습니다.

Spring Data JPA 명명 규칙을 준수하고 Optional 반환 타입으로 null-safety를 보장하는 좋은 구현입니다.

src/main/java/project/flipnote/common/entity/SoftDeletableEntity.java (3)

12-12: 필드명 변경이 적절합니다.

deletedDate에서 deletedAt으로의 변경은 시간 정보를 포함한 더 정확한 의미를 나타내며, 일반적인 명명 규칙을 따릅니다.


15-15: 메서드 내 참조가 올바르게 업데이트되었습니다.

필드명 변경에 따른 일관된 업데이트가 적용되었습니다.


19-19: 조건 검사 메서드가 올바르게 업데이트되었습니다.

변경된 필드명이 적절히 반영되어 있습니다.

src/main/java/project/flipnote/user/controller/UserController.java (3)

5-6: 필요한 import가 올바르게 추가되었습니다.

@AuthenticationPrincipal@DeleteMapping 사용을 위한 import가 적절히 추가되었습니다.


14-14: 인증 관련 DTO import가 올바릅니다.

UserAuth DTO를 통한 인증 정보 처리가 적절합니다.


32-36: 회원 탈퇴 엔드포인트가 올바르게 구현되었습니다.

REST API 관례를 준수하고, 인증된 사용자 정보를 통해 보안을 보장하며, 적절한 HTTP 상태 코드를 반환하는 좋은 구현입니다.

src/main/java/project/flipnote/user/service/UserService.java (4)

13-13: 필요한 import가 올바르게 추가되었습니다.

UserStatus enum 사용을 위한 import가 적절히 추가되었습니다.


54-59: 회원 탈퇴 메서드가 올바르게 구현되었습니다.

@Transactional 어노테이션으로 트랜잭션 무결성을 보장하고, 활성 사용자 검증 후 소프트 딜리트를 수행하는 적절한 구현입니다.


61-64: 헬퍼 메서드가 잘 설계되었습니다.

활성 상태의 사용자만 조회하고 적절한 예외 처리를 하는 재사용 가능한 헬퍼 메서드입니다. 코드의 가독성과 유지보수성을 향상시킵니다.


54-64: 연관 엔터티 미발견 – 추가 처리 불필요합니다
현재 코드베이스 내에서 JPA 어노테이션(@OnetoOne, @manytoone, @onetomany 등)을 통해 User 엔터티를 참조하는 다른 도메인 엔터티가 존재하지 않습니다. 사용자 소프트 딜리트만으로도 무방하며, 별도의 연관 데이터 처리 로직은 필요하지 않습니다.

src/test/java/project/flipnote/user/service/UserServiceTest.java (2)

7-7: 새로운 import문 추가 승인

테스트 기능 확장을 위한 적절한 import문들이 추가되었습니다. Optional, UserFixture, UserStatus는 모두 새로운 탈퇴 테스트와 fixture 사용에 필요한 요소들입니다.

Also applies to: 23-23, 25-25


54-54: fixture 사용으로 테스트 코드 개선

수동으로 사용자 인스턴스를 생성하던 방식을 UserFixture.createActiveUser()로 변경한 것은 좋은 개선입니다. 테스트 데이터 생성의 일관성과 유지보수성이 향상됩니다.

Also applies to: 75-75

@dungbik dungbik merged commit d254f8d into develop Jul 16, 2025
3 checks passed
@dungbik dungbik deleted the feat/unregister-user branch July 16, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants